import { Injectable } from '@angular/core';
@Injectable()
export class DictionaryService {
  dictionary:any = {
    business: [{
      value: 1,
      label: '运动服'
    }, {
      value: 2,
      label: '西装'
    }, {
      value: 3,
      label: '夹克'
    }, {
      value: 4,
      label: '羽绒服'
    }, {
      value: 5,
      label: '棉衣'
    }, {
      value: 6,
      label: '沙滩裤'
    }, {
      value: 7,
      label: '衬衫'
    }, {
      value: 8,
      label: '针织'
    }],
    gender: [{
      value: '女',
      label: '女'
    }, {
      value: '男',
      label: '男'
    }],
    orderStatus: [{
      value: 0,
      label:'订单未完成'
    },{
      value: 1,
      label:'订单已完成'
    }]
  };
  constructor() {}
  public getByType(type) {
    return this.dictionary[type]
  }
  public getLableByTypeAndvalue(type, value) {
    let result = ''
    this.dictionary[type].forEach(data => {
      if (data.value  === value) {
        result = data.label
      }
    })
    return result
  }
}